#!/usr/bin/env node

const glob = require('glob')
const path = require('path')
const execa = require('execa')

const packages = glob.sync(
  path.join(__dirname, '..', 'packages/*/package.json')
)

async function main() {
  for (const packageJSON of packages) {
    const pjson = require(packageJSON)
    if (pjson.scripts && pjson.scripts["test:acceptance"]) {
      await execa('yarn', ['test:acceptance'], {
        cwd: path.dirname(packageJSON),
        stdio: 'inherit'
      })
    }
  }
}


main()